#include "Game.hpp"
#include "Player.hpp"
#include "Misc.hpp"
#include "Board.hpp"
#include "Piece.hpp"

namespace apng {

	namespace checkers {

		namespace game {

			Game::Game() {

			}

			Game::~Game() {

			}

			Game::Game(int width, int height) {
				Board* board = new Board(width, height);
				this->board = board;

			}

			void Game::setPlayer(Player* player, PlayerType type) {

				if (type == PLAYER1) {
					 this->player1 = player;
				}
				else {
					 this->player2 = player;
				}

			}

			Player* Game::getPlayer(apng::checkers::player::PlayerType type) const {

				switch (type) {

					case PLAYER1:

						return this->player1;
						break;

					case PLAYER2:

						return this->player2;
						break;
				}
			}

			PlayerType Game::getPlayerType(Player* player) const {
				if(player == this->player1) {
					return PLAYER1;
				}
				else {
					return PLAYER2;
				}

			}

			void Game::changeCurrentPlayer(void) {
				//TODO

			}

			void Game::changeCurrentPlayer(apng::checkers::player::PlayerType type) {
				//TODO

			}

			Board* Game::getBoard(void) const {
				return this->board;
			}

			void Game::setBoard(Board* board) {
				this->board = board;
			}

			bool Game::verifyWinner(void) const {
				return true; //TODO

			}

			Player* Game::getWinner(void) const {
				return player1; //TODO

			}

			bool Game::verifyMove(unsigned int fromx, unsigned int fromy, unsigned int tox, unsigned int toy) const {
				return true; //TODO

			}

			bool Game::movePiece(unsigned int fromx, unsigned int fromy, unsigned int tox, unsigned int toy) const {
				return true; //TODO

			}

		}//fecha namespace game

	}//fecha namespace checkers

}//fecha namespace apng
